/**
 ********************************************************************
 * @author roocket
 * @file    main.c
 * @version V0.0.0
 * @date    2024/3/22
 * @brief   This file is to indicate main functions. 
 * @attention Code file rules:
 * rule: file encoding use UTF8;
 * rule: max line length 120 characters;
 * rule: line separator \r\n;
 * rule: use clion auto code format tool.
 */
#include "queue.h"

int main()
{
    int ret= -1;

    struct queue_setting setting = 
    {
        .id     = 0,
        .flag   = 18,
        .mtype  = 1,
        .snd_mode = IPC_NOWAIT,
        .key_string = "/home/roocket/roocket_linux/app/queue",
    };

    ret = queue_init(&setting);
    if (-1 == ret) {
        perror("init failed\n");
        return -1;
    }

    while (1) {
    struct queue q = {0};
    char string[32] = "helloworld";

    ret = queue_set_data(string, strlen(string), &setting);
    ret = queue_get_data(&q, &setting);
    if (q.qdata.len)
        printf("queue's qdata.mtext:%s\n", q.qdata.mtext);
        sleep(1);
    }
    return 0;
}
